package com.demo.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.util.ShardingUtil;
import groovy.util.logging.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class TestJob {
    @XxlJob("sendMessage")
    public ReturnT<String> sendMessage(String message) {
        ShardingUtil.ShardingVO shardingVo = ShardingUtil.getShardingVo();
        int total = shardingVo.getTotal();
        int index = shardingVo.getIndex();
        System.out.println("总分片数："+total+"当前分片数：" + index);
        System.out.println("message " + message);
        return new ReturnT<String>();
    }
}
